package it.uniroma2.structure.deploy;

public class Provide {
	private final String partnerLinkAttr = "partnerLink";
	private final String partnerLinkValue = "client";
	private final String providerTag = "provide";
	private final String serviceTag = "service";
	private String serviceName;
	private String portName;
	
	public Provide(String namespace, String nameBPEL){
		String temp = namespace.split("http://")[1];
		this.serviceName = temp + ":" + nameBPEL;
		this.portName = nameBPEL + "Port";
	}
	
	public String generateProvide(){
		String output = "<" + this.providerTag + " " + this.partnerLinkAttr + "=\"" + this.partnerLinkValue + "\">\n";
		
		output = output + "<" + this.serviceTag + " name=\"" + this.serviceName  + "Service\" port=\"" + this.portName  + "\"/>\n";
		
		output = output + "</" + this.providerTag + ">\n";		
		return output;
	}
}
